﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using eStudying.Repository.Repository;
using eStudying.Core.Objects;
using eStudying.Core.Envelopes;

namespace eStudying.Client.Controllers
{
    public class eStudyingController : Controller
    {
        //
        // GET: /eStudying/

        public ActionResult Login()
        {
            return View();

        }

        [HttpPost]
        public ActionResult Login(LoginRQ req)
        {
            eStudying.Services.Client.Service serviceUI = new eStudying.Services.Client.Service();
            var test = serviceUI.LoginTo(null);
            //   ChooseQuestionRepository coQstRepository = new ChooseQuestionRepository();
            //   coQstRepository.Add(coQuestion);
            return RedirectToAction("Home");
        }

        public ActionResult AlterUser()
        {
            return View();
        }

        public ActionResult AnswerMultiChooseQuestion()
        {

            return View();
        }

        public ActionResult AnswerQuestion()
        {
            return View();
        }

        public ActionResult CreateArticle()
        {
            return View();
        }

        [HttpPost]
        public ActionResult CreateArticle(Article article)
        {
            ArticleRepository articleRepository = new ArticleRepository();
            articleRepository.Add(article);
            return RedirectToAction("Home");
        }

        public ActionResult CreateEvent()
        {
            return View();
        }

        public ActionResult CreateMultiChooseQuestion()
        {
            return View();
        }

        [HttpPost]
        public ActionResult CreateMultiChooseQuestion(ChooseQuestion coQuestion)
        {

            ChooseQuestionRepository coQstRepository = new ChooseQuestionRepository();
            coQstRepository.Add(coQuestion);
            return RedirectToAction("Home");
        }

        public ActionResult CreateNewUser()
        {
            return View();
        }

        [HttpPost]
        public ActionResult CreateNewUser(User user)
        {

            UserRepository userRepository = new UserRepository();
            userRepository.Add(user);
            return RedirectToAction("Home");
        }

        public ActionResult CreateQuestion()
        {
            return View();
        }

        public ActionResult CreateReport()
        {
            return View();
        }

        public ActionResult CreateRoadMap()
        {
            return View();
        }

        public ActionResult CreateSimulated()
        {
            return View();
        }

        public ActionResult DoSimulated()
        {
            return View();
        }

        public ActionResult Favorite()
        {
            return View();
        }

        public ActionResult Home()
        {
            ViewData["Articles"] = getArticles();
            return View();
        }

        private List<Article> getArticles()
        {
            ArticleRepository articleRepository = new ArticleRepository();

            return articleRepository.Find();
        }
        public ActionResult HomeContent()
        {
            return View();
        }

        public ActionResult HomeEvent()
        {
            return View();
        }

        public ActionResult HomeUser()
        {
            return View();
        }

        public ActionResult MyEvents()
        {
            return View();
        }

        public ActionResult MyReports()
        {
            return View();
        }
        public ActionResult RecoverPassword()
        {
            return View();
        }

        public ActionResult ShowArticle(int id)
        {
            ArticleRepository articleRepository = new ArticleRepository();
            Article article = articleRepository.Find(id);
            //   return View(article);
            ViewData["article"] = article;

            return View();
        }

        public ActionResult ShowRoadMap()
        {
            return View();
        }

    }
}
